<#assign ctx=request.contextPath />
<!--_meta 作为公共模版分离出去-->
<#include "comm/_meta.html" />
<!--/meta 作为公共模版分离出去-->
<title>添加教室 - 教室管理</title>

</head>
<body>
	<article class="cl pd-20">
		<form class="form form-horizontal" id="form-admin-add">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span
					class="c-red">*</span>教室：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text"
						value="${classroom.crName }" placeholder="" id="crName"
						name="crName"> 
					<input type="hidden"
						value="${classroom.crId }" name="crId">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span
					class="c-red">*</span>投影：</label>
				<div class="formControls col-xs-8 col-sm-9 skin-minimal">
					<div class="radio-box">
						<input name="progector" type="radio" id="sex-1" value="是"
							${(classroom.touying?default('0')=='1')?string('checked="checked"','checked')!}
							<label for="sex-1">是</label>
					</div>
					<div class="radio-box">
						<input name="progector" type="radio" id="sex-2" value="否"
							${(classroom.touying?default('0')=='0')?string('checked="checked"','')!}
						<label for="sex-2">否</label>
					</div>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary radius" type="submit"
						value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>

	<!--_footer 作为公共模版分离出去-->
	<#include "comm/_footer.html" />
	<!--/_footer /作为公共模版分离出去-->

	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript"
		src="${ctx}/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
	<script type="text/javascript"
		src="${ctx }/static/lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript"
		src="${ctx }/static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.skin-minimal input').iCheck({
				checkboxClass : 'icheckbox-blue',
				radioClass : 'iradio-blue',
				increaseArea : '20%'
			});

			$("#form-admin-add").validate({
				rules : {
					crname : {
						required : true
					},
					progector : {
						required : true
					},
				},
				onkeyup : false,
				focusCleanup : true,
				success : "valid",
				submitHandler : function(form) {
					$(form).ajaxSubmit({
						type: 'post',
						url: "${ctx}/room/saveRoom" ,
						success: function(data){
							layer.msg('添加成功!',{icon:1,time:1000},function(){
								//刷新页面
								reload();
		                    });
						},
		                error: function(XmlHttpRequest, textStatus, errorThrown){
							layer.msg('error!',{icon:1,time:1000});
						}
					});
				}
			});
		});
		
		// 重新加载页面
		function reload(){
			//获取父层  
            var index = parent.layer.getFrameIndex(window.name);  
            //刷新父层  
            parent.location.reload();  
            //关闭弹出层  
            parent.layer.close(index);  
		}
	</script>
	<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>